
import { myRequest } from './http.js'

let path = 'api/services/app/'
let api = {
	async getAddressListAsync(data, callback) {
		 let address =  await myRequest({ url: path + 'FrontUser/GetAddressListAsync', method: 'POST', data: data || {}  })
		 callback&&callback(address)
	},
	
	async removeAddressAsync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/RemoveAddressAsync', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	async saveAddressSaync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/SaveAddressSaync', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	// 设置默认收货地址
	async updateDefaultAddress(data, callback) {
		 let address =  await myRequest({ url: path + 'FrontUser/UpdateDefaultAddress', method: 'POST', data: data || {}  })
		 callback&&callback(address)
	},
	
	async saveUserCardAsync(data, callback) {
		 let address =  await myRequest({ url: path + 'FrontUser/SaveUserCardAsync', method: 'POST', data: data || {}  })
		 callback&&callback(address)
	},
	
	async getUserCardsAsync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/GetUserCardsAsync', method: 'GET', data: data || {}  })
		 callback&&callback(res)
	},
	
	async removeUserCardAsync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/removeUserCardAsync', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	// 实名认证
	async realNameAuth(data, callback) {
		 let res =  await myRequest({ url: path + 'IdentityAuth/RealNameAuth', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	// 店铺申请
	async shopApplication(data, callback) {
		 let res =  await myRequest({ url: path + 'Shop/ShopApplication', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	// 企业店铺认证
	async shopAuth(data, callback) {
		 let res =  await myRequest({ url: path + 'Shop/ShopAuth', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	// 提现记录
	async userCashRecord(data, callback) {
		let {pageIndex, pageSize, type} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, type }
		let res =  await myRequest({ url: path + 'FrontUser/UserCashRecord', method: 'POST', data: data2 || ''  })
		callback&&callback(res)
	},
	
	// h5登录接口
	async loginAsync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/LoginAsync', method: 'POST', data: data || ''  })
		 callback&&callback(res)
	},
	
	// APP登录接口
	async loginFromAppAsync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/LoginFromAppAsync', method: 'POST', data: data || ''  })
		 console.log('api');
		 console.log(res);
		 callback&&callback(res)
	},
	
	// 绑定手机号
	async setUserPhoneAsync(data, callback) {
		 let res =  await myRequest({ url: path + 'FrontUser/SetUserPhoneAsync', method: 'POST', data: data || ''  })
		 callback&&callback(res)
	},
	
	// 首页搜索
	async searchReturnPages(data, callback) {
		let pageIndex = data.pageIndex
		let pageSize = data.pageSize
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, tabType: data.tabType, sort: data.sort, searchKey: data.searchKey }
		let res =  await myRequest({ url: path + 'HomePageAppservice/SearchReturnPages', method: 'POST', data: data2 || ''  })
		callback&&callback(res)
	},
	
	// 首页Banner
	async bannerList(data, callback) {
		 let res =  await myRequest({ url: path + 'MyWeb/BannerList', method: 'POST', data: data || {}  })
		 callback&&callback(res)
	},
	
	// 首页公告
	async getNoticeList(data, callback) {
		 let res =  await myRequest({ url: path + 'HomePageAppservice/GetNoticeList', method: 'POST', data: data || ''  })
		 callback&&callback(res)
	},
	
	// 首页商品
	async getRecommendList(data, callback) {
		let { pageIndex, pageSize, listType } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, listType }
		let res =  await myRequest({ url: path + 'HomePageAppservice/GetRecommendList', method: 'GET', data: data2  })
		 callback&&callback(res)
	},
	
	// 拼团详情
	async getD(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/GetAssembleDetails', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 拼团商品详情
	async getAssembleDetails(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/AssembleDetailsById', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 我的团列表
	async getMyAssPage(data, callback) {
		let { pageIndex, pageSize, assState } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, assState }
		let res =  await myRequest({ url: path + 'Commodity/GetMyAssPage', method: 'POST', data: data2 || '' })
		 callback&&callback(res)
	},
	
	// 获取升级团长费用
	async getUpgradeAmount(data, callback) {
		let res =  await myRequest({ url: path + 'Order/GetUpgradeAmount', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 商品下单接口
	async placeAnOrder(data, callback) {
		let res =  await myRequest({ url: path + 'Order/PlaceAnOrder', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 团长开团
	async addAssemble(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/AddAssemble', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 发送验证码
	async sendCodeAsync(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/SendCodeAsync', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 获取团队成员列表
	async userTeamPages(data, callback) {
		let {pageIndex, pageSize, gradeType} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, gradeType }
		let res =  await myRequest({ url: path + 'FrontUser/UserTeamPages', method: 'POST', data: data2 || '' })
		 callback&&callback(res)
	},
	
	// 获取团队成员下级成员
	async getTeamByUserId(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/GetTeamByUserId', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 获取优惠券
	async getUserCoupons(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/GetUserCoupons', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 获取用户收益信息
	async userProfitAsync(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/UserProfitAsync', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 获取用户收益记录
	async incomeRecord(data, callback) {
		let {pageIndex, pageSize, commType} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, commType }
		let res =  await myRequest({ url: path + 'FrontUser/IncomeRecord', method: 'POST', data: data2 || '' })
		 callback&&callback(res)
	},
	
	// 提现到余额
	async commissionToBalance(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/CommissionToBalance', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 提现到银行卡
	async saveUserCash(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/SaveUserCash', method: 'POST', data: data || '' })
		 callback&&callback(res)
	},
	
	// 获取用户豆豆
	async integralRecord(data, callback) {
		let {pageIndex, pageSize, type} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, type }
		let res =  await myRequest({ url: path + 'FrontUser/IntegralRecord', method: 'POST', data: data2 || '' })
		 callback&&callback(res)
	},
	
	// 获取用户购物订单列表
	async returnUserOrderPages(data, callback) {
		let {pageIndex, pageSize, status, orderType} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize,  status, orderType }
		let res =  await myRequest({ url: path + 'Order/ReturnUserOrderPages', method: 'POST', data: data2 || '' })
		callback&&callback(res)
	},
	
	// 获取用户购物订单详情
	async orderDetailsById(data, callback) {
		let res =  await myRequest({ url: path + 'Order/OrderDetailsById?id='+data.orderId, method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 用户取消订单
	async cancelOrder(data, callback) {
		let res =  await myRequest({ url: path + 'Order/CancelOrder', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 未付款订单付款
	async payByOrderId(data, callback) {
		let res =  await myRequest({ url: path + 'Order/PayByOrderId', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 获取用户拼团订单列表
	async returnAssembleOrderPages(data, callback) {
		let {pageIndex, pageSize, status } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize,  status }
		let res =  await myRequest({ url: path + 'Order/ReturnAssembleOrderPages', method: 'POST', data: data2 || '' })
		callback&&callback(res)
	},
	
	// 获取用户拼团订单详情
	async assembleOrderDetails(data, callback) {
		let res =  await myRequest({ url: path + 'Order/AssembleOrderDetails', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 获取购物车下单折扣方式
	async getShoppinCartDiscount(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/GetShoppinCartDiscount', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 获取优惠券列表
	async couponListA(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/CouponListA', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 领取优惠券
	async grabCoupons(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/GrabCoupons', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 获取用户信息
	async getUserInfoAsync(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/GetUserInfoAsync', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 购物车下单
	async shoppingCartSettlement(data, callback) {
		let res =  await myRequest({ url: path + 'Order/ShoppingCartSettlement', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 店铺商品分类
	async getShopInsideTypeList(data, callback) {
		let res =  await myRequest({ url: path + 'Commodity/GetShopInsideTypeList', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 店铺商品列表
	async getSpuListByType(data, callback) {
		let {pageIndex, pageSize, typeId, shopId } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize,  typeId, shopId }
		let res =  await myRequest({ url: path + 'Commodity/GetSpuListByType', method: 'GET', data: data2 || '' })
		callback&&callback(res)
	},
	
	// 获取店铺信息
	async getMyShopInfo(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/GetMyShopInfo', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 根据Id获取店铺信息
	async GetShopById(data, callback) {
		let res =  await myRequest({ url: path + 'FrontUser/GetShopById', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 获取文章列表
	async artclePagesByType(data, callback) {
		let {pageIndex, pageSize, id } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, id }
		let res =  await myRequest({ url: path + 'Article/ArtclePagesByType', method: 'POST', data: data2 || '' })
		callback&&callback(res)
	},
	
	// 获取文章详情
	async artDetails(data, callback) {
		let res =  await myRequest({ url: path + 'Article/ArtDetails', method: 'POST', data: data || '' })
		callback&&callback(res)
	},
	
	// 获取拼团玩法
	async getArtByCode(data, callback) {
		let res =  await myRequest({ url: path + 'Article/GetArtByCode', method: 'GET', data: data || '' })
		callback&&callback(res)
	}
}

export { api }